package day14homework;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class TcpClientS {
    public static void main(String[] args) throws IOException {
        //读取文件
        FileInputStream fis = new FileInputStream("D:\\lxlxlx\\lx\\a.png");
        // 1.创建文件
        Socket socket = new Socket("127.0.0.1",8080);
        // 2.获得输出流
        OutputStream out = socket.getOutputStream();
        // 3.读取文件内容
        int result;
        while ((result = fis.read())!=-1){
            // 3.往里面写数据
            out.write(result);
        }
        // 4.关闭
        socket.close();
    }
}
